﻿using System;
using Controller;
using Model;

public partial class ACPanel_NodeTour_DeleteDieukhoan : System.Web.UI.Page
{
    public static string _idTour;
    public static int _id;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var id = Request.QueryString["Id"];
            var idTour = Request.QueryString["IdTour"];
            if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(idTour))
            {
                _id = Convert.ToInt32(id);
                _idTour = idTour;
                litIdChuyenmuc.Text = id;
            }
        }
    }

    public int DeleteLoaiChuyenMuc(ModelVYC25 model)
    {
        var controller = new VYC25Controller();
        return controller.DeleteData(model);
    }

    protected void btnHuy_OnClick(object sender, EventArgs e)
    {
        Response.Redirect("~/ACPanel/NodeTour/QLDieukhoan.aspx?Id=" + _idTour);
    }

    protected void btnXoa_OnClick(object sender, EventArgs e)
    {
        var model = new ModelVYC25 { Id = _id };
        Response.Redirect(DeleteLoaiChuyenMuc(model) > 0 ? "~/ACPanel/NodeTour/QLDieukhoan.aspx?Id=" + _idTour : "~/ACPanel/Error.aspx");
    }
}